/*
* Copyright 2024 NXP
* NXP Confidential and Proprietary. This software is owned or controlled by NXP and may only be used strictly in
* accordance with the applicable license terms. By expressly accepting such terms or by downloading, installing,
* activating and/or otherwise using the software, you are agreeing that you have read, and that you agree to
* comply with and are bound by, such license terms.  If you do not agree to be bound by the applicable license
* terms, then you may not retain, install, activate or otherwise use the software.
*/

#include "lvgl.h"
#include <stdio.h>
#include "gui_guider.h"
#include "events_init.h"
#include "widgets_init.h"
#include "custom.h"


void setup_scr_screen_panel(lv_ui *ui)
{
	//Write codes screen_panel
	ui->screen_panel = lv_obj_create(NULL);
	lv_obj_set_size(ui->screen_panel, 480, 320);
	lv_obj_set_scrollbar_mode(ui->screen_panel, LV_SCROLLBAR_MODE_OFF);

	//Write style for screen_panel, Part: LV_PART_MAIN, State: LV_STATE_DEFAULT.
	lv_obj_set_style_bg_opa(ui->screen_panel, 0, LV_PART_MAIN|LV_STATE_DEFAULT);

	//Write codes screen_panel_img_panel
	ui->screen_panel_img_panel = lv_img_create(ui->screen_panel);
	lv_obj_add_flag(ui->screen_panel_img_panel, LV_OBJ_FLAG_CLICKABLE);
	lv_img_set_src(ui->screen_panel_img_panel, &_0_3_480x320);
	lv_img_set_pivot(ui->screen_panel_img_panel, 50,50);
	lv_img_set_angle(ui->screen_panel_img_panel, 0);
	lv_obj_set_pos(ui->screen_panel_img_panel, 0, 0);
	lv_obj_set_size(ui->screen_panel_img_panel, 480, 320);
	lv_obj_set_scrollbar_mode(ui->screen_panel_img_panel, LV_SCROLLBAR_MODE_OFF);

	//Write style for screen_panel_img_panel, Part: LV_PART_MAIN, State: LV_STATE_DEFAULT.
	lv_obj_set_style_img_opa(ui->screen_panel_img_panel, 255, LV_PART_MAIN|LV_STATE_DEFAULT);

	//Write codes screen_panel_meter_panel
	ui->screen_panel_meter_panel = lv_meter_create(ui->screen_panel);
	// add scale screen_panel_meter_panel_scale_1
	lv_meter_scale_t *screen_panel_meter_panel_scale_1 = lv_meter_add_scale(ui->screen_panel_meter_panel);
	lv_meter_set_scale_ticks(ui->screen_panel_meter_panel, screen_panel_meter_panel_scale_1, 41, 1, 1, lv_color_hex(0x000000));
	lv_meter_set_scale_range(ui->screen_panel_meter_panel, screen_panel_meter_panel_scale_1, 0, 360, 360, 90);

	// add needle line for screen_panel_meter_panel_scale_1.
	ui->screen_panel_meter_panel_scale_1_ndline_0 = lv_meter_add_needle_line(ui->screen_panel_meter_panel, screen_panel_meter_panel_scale_1, 2, lv_color_hex(0xffffff), -10);
	lv_meter_set_indicator_value(ui->screen_panel_meter_panel, ui->screen_panel_meter_panel_scale_1_ndline_0, 60);
	lv_obj_set_pos(ui->screen_panel_meter_panel, 140, 60);
	lv_obj_set_size(ui->screen_panel_meter_panel, 200, 200);
	lv_obj_set_scrollbar_mode(ui->screen_panel_meter_panel, LV_SCROLLBAR_MODE_OFF);

	//Write style for screen_panel_meter_panel, Part: LV_PART_MAIN, State: LV_STATE_DEFAULT.
	lv_obj_set_style_bg_opa(ui->screen_panel_meter_panel, 0, LV_PART_MAIN|LV_STATE_DEFAULT);
	lv_obj_set_style_radius(ui->screen_panel_meter_panel, 200, LV_PART_MAIN|LV_STATE_DEFAULT);
	lv_obj_set_style_border_width(ui->screen_panel_meter_panel, 0, LV_PART_MAIN|LV_STATE_DEFAULT);
	lv_obj_set_style_shadow_width(ui->screen_panel_meter_panel, 0, LV_PART_MAIN|LV_STATE_DEFAULT);

	//Write style for screen_panel_meter_panel, Part: LV_PART_TICKS, State: LV_STATE_DEFAULT.
	lv_obj_set_style_text_color(ui->screen_panel_meter_panel, lv_color_hex(0xff0000), LV_PART_TICKS|LV_STATE_DEFAULT);
	lv_obj_set_style_text_font(ui->screen_panel_meter_panel, &lv_font_montserratMedium_12, LV_PART_TICKS|LV_STATE_DEFAULT);

	//Update current screen layout.
	lv_obj_update_layout(ui->screen_panel);

	
	//Init events for screen.
	events_init_screen_panel(ui);
}
